/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.lcfgly.Form.Validation;

import com.lcfgly.Database.ShopUsermenu;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

/**
 *
 * @author lcfgly
 */
public class userMenuValidation implements Validator{

    @Override
    public boolean supports(Class<?> clazz) {
        return ShopUsermenu.class.equals(clazz);
    }

    @Override
    public void validate(Object target, Errors errors) {
       ValidationUtils.rejectIfEmpty(errors, "typename",null, "栏目名称不能为空");
        ShopUsermenu menuadd=(ShopUsermenu)target;
        if(menuadd.getSort() ==0) {
            menuadd.setSort((short)50);
        } 
    }
    
}
